package so.sao.code.service.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import so.sao.code.service.domain.entity.TagScrap;
import so.sao.code.service.infrastructure.enums.TAG_SCRAP_TYPE;
@Repository
public interface TagScrapDao extends JpaRepository<TagScrap, Long> {

	Page<TagScrap> findAll(Specification<TagScrap> spec, Pageable pageable);

	TagScrap findBySeqnum(Long seqNum);

	TagScrap findByRangeId(Long id);

	TagScrap findByTagBatchId(Long id);
	@Query(value = "select top 1 * from tag_scrap where ?1 between seqnum_start and seqnum_end", nativeQuery = true)
	TagScrap getScrapInfoBySeqnum(Long seqNum);

	List<TagScrap> findByType(TAG_SCRAP_TYPE type);

	
	
}
